package com.x.Part8_多态;


/**
 * ClassName: Animal
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024/1/10 14:17
 */
class Animal {
    String name;
    int age;


    public void eat(){
        System.out.println("eat");
    }

    public void work(){
        System.out.println("work");
    }
}

class Cat extends Animal {


    public void eat() {
        System.out.println("吃鱼");
    }
    public void work() {
        System.out.println("抓老鼠");
    }
}

class Dog extends Animal {

    public void eat() {
        System.out.println("吃骨头");
    }
    public void work() {
        System.out.println("看家");
    }
}